package org.smart.framework.helper;

import org.smart.framework.ConfigConstant;
import org.smart.framework.util.PropsUtil;

import java.util.Properties;

/**
 * Created by IntelliJ IDEA.
 * 属性文件助手
 *
 * @Auther Uncle_Z
 * @date 2017/8/23 14:13
 * @Email:2545375@qq.com
 * @since 1.0
 * <p>
 * To change this template use File | Settings | File Templates.
 */

public final class ConfigHelper {

    private static final Properties CONFIG_PROPS = PropsUtil.loadProps(ConfigConstant.CONFIG_PATH);

    /**
     * 获取JDBC驱动
     * @return
     */
    public static String getJdbcDriver() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_DRIVER);
    }

    /**
     * 获取JDBC_url
     * @return
     */
    public static String getJdbcUrl() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_URL);
    }

    public static String getJdbcUsername() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_USERNAME);
    }

    public static String getJdbcPassword() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_PASSWORD);
    }

    public static String getAppBasePackage(){
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_BASE_PACKAGE);

    }

    public static String getAppFreemarkerPath() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_FREEMARKER_PATH, "/views");
    }

    public static String getAppAssetPath() {
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_ASSET_PATH, "/asset/");
    }
}
